package hotciv.view.stubs;

import org.junit.Before;

import hotciv.framework.*;
import hotciv.standard.*;
import hotciv.variant.*;

/** A Test Stub for game that 'fakes' behavior but still provides enough
 * for testing the graphical user interface.
 * Moves are always valid, except 1) position (0,0) and 2) moving one
 * unit on top of another. Blue city increase in size at each end of turn call.
<#if type == "code">

<#include "/data/author.txt">
</#if>
*/

public class GameStub extends HotCivGame implements Game {
  private Position pos_city_red;
  private Position pos_city_blue;

  public GameStub() {
    super(new SemiCivFactory());
    pos_city_red = new Position( 8, 15 );
    pos_city_blue = new Position( 4, 5 );
  }
  protected int blueCitySize = 2;
  
  public City getCityAt(Position p) {
    if ( p.equals(pos_city_red)) {
      return new City() {
        public Player getOwner() { return StandardPlayer.RED; }
        public int getSize() { return 1; }
        public String getProduction() {
          return null;
        }
        public String getWorkforceFocus() {
          return null;
        }
      };
    }
    if ( p.equals(pos_city_blue)) {
      return new City() {
        public Player getOwner() { return StandardPlayer.BLUE; }
        public int getSize() { return blueCitySize; }
        public String getProduction() {
          return null;
        }
        public String getWorkforceFocus() {
          return null;
        }
      };
    }
    return null;
  }
/**
  @Override
  public void endOfTurn() {
	
    System.err.println( "End of Turn");
  }
*/
  @Override
  public Player getWinner() {
    return null;
  }

  @Override
  public Player getPlayerInTurn() {
    return StandardPlayer.RED;
  }

  int count = 0;

  public void testModelChange() {
    System.out.println("Game change: "+count);
    //_changedAt(pos_archer);
    Position pos_archer = new Position( 5+count, 10+count);
    //_changedAt(pos_archer);
    count++;
    
    blueCitySize++;
    //_changedAt(pos_city_blue);
  }
 
}
